# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Florian Loitsch <archlinux@florian.loitsch.com>

pkgbase=miniupnpc
pkgname=(miniupnpc python-miniupnpc)
pkgver=2.2.4
pkgrel=2
pkgdesc='Small UPnP client library/tool to access Internet Gateway Devices'
url='https://miniupnp.tuxfamily.org/'
arch=('loong64' 'x86_64')
license=('BSD')
makedepends=('sh' 'glibc' 'lsb-release' 'python' 'python-setuptools')
source=(https://miniupnp.tuxfamily.org/files/${pkgname}-${pkgver}.tar.gz{,.sig})
sha512sums=('f6515bda86405114016474fef6332c0c09a56b9293cf4391113f549444bab67e7d031af7b94dacff5e7c96d6508527204498c00fb67d6067685ef606b2152595'
            'SKIP')
b2sums=('ebfea3fe978280825b7beefb8fe799685a72b0a74c589f5f55c7fde3d8c0d4bbb3d50fa0ff3aed554fa1e24ada0a1ab578328373f0295020415998fe35cde0a0'
        'SKIP')
validpgpkeys=(
  '751E9FF6944A3B36A5432216DB511043A31ACAAF' # miniupnp (miniupnp !) <miniupnp@free.fr>
)

build() {
  cd ${pkgname}-${pkgver}
  make
  python setup.py build
}

check() {
  cd ${pkgname}-${pkgver}
  make test
}

package_miniupnpc() {
  depends=(sh glibc)
  provides=(libminiupnpc.so)

  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 man3/miniupnpc.3 -t "${pkgdir}/usr/share/man/man3"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

package_python-miniupnpc() {
  pkgdesc='Python bindings for miniupnpc'
  depends=(python glibc)

  cd ${pkgbase}-${pkgver}
  python setup.py install --optimize=1 --skip-build --root="$pkgdir"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
